﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Dsl.Ped.Common.Converters
{
    /// <summary>
    /// Converts null value to <see cref="Boolean"/> value
    /// </summary>
    public class NullToBoolConverter : IValueConverter
    {
        #region Implementation of IValueConverter

        /// <summary>
        /// Converts the null value to <see cref="Boolean"/>
        /// Null = false, !Null = true
        /// </summary>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value != null ? true : false;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
